Index: skins/colibri/src/main/resources/colibri/menuview.vm
===================================================================
--- skins/colibri/src/main/resources/colibri/menuview.vm	(revision 28993)
+++ skins/colibri/src/main/resources/colibri/menuview.vm	(working copy)
@@ -7,10 +7,10 @@
 ##
 #if(!$context.action.startsWith('login'))
   #if($isGuest)
-    #set($loginurl = $xwiki.getURL('XWiki.XWikiLogin', 'login', "xredirect=$util.encodeURI($xwiki.getRequestURL())"))
+    #set($loginurl = $xwiki.getURL('XWiki.XWikiLogin', 'login', "xredirect=$escapetool.url($xwiki.getRequestURL())"))
     #xwikitopmenuentry($!loginurl $!msg.get('login') 'tmLogin')
   #else
-    #set($logouturl = $xwiki.getURL('XWiki.XWikiLogout', 'logout', "xredirect=$util.encodeURI($xwiki.getRequestURL())"))
+    #set($logouturl = $xwiki.getURL('XWiki.XWikiLogout', 'logout', "xredirect=$escapetool.url($xwiki.getRequestURL())"))
     #xwikitopmenuentry($!logouturl $!msg.get('logout') 'tmLogout')
   #end
 #end
@@ -50,7 +50,7 @@
   #if ($hasWatch)
     #set ($isWikiWatched = $xwiki.watchlist.isWikiWatched())
     #if (!$isWikiWatched)
-      #submenuitem("$doc.getURL('view', 'xpage=watch&amp;do=addwiki')&amp;xredirect=$doc.getURL()" $msg.get('core.menu.watchlist.add.wiki', [$xwiki.getXMLEncoded($doc.wiki)]) 'tmWatchWiki', '')
+      #submenuitem("$doc.getURL('view', 'xpage=watch&amp;do=addwiki')&amp;xredirect=$doc.getURL()" $msg.get('core.menu.watchlist.add.wiki', [$escapetool.xml($doc.wiki)]) 'tmWatchWiki', '')
     #else
       #submenuitem("$doc.getURL('view', 'xpage=watch&amp;do=removewiki')&amp;xredirect=$doc.getURL()" $msg.get('core.menu.watchlist.remove.wiki') 'tmUnwatchWiki', '')
     #end
@@ -71,28 +71,28 @@
 ##
 #set ($displaySpaceSubmenu = $hasWatch || $hasCreatePage || $hasSpaceAdmin)
 #if(!$displaySpaceSubmenu)
-  #xwikitopmenuentry($xwiki.getURL("${doc.space}.WebHome", 'view') $doc.space 'tmSpace' 'hasIcon')
+  #xwikitopmenuentry($xwiki.getURL("${doc.space}.WebHome", 'view') "$!{escapetool.xml($doc.space)}" 'tmSpace' 'hasIcon')
 #else
-  #xwikitopmenuentrystart($xwiki.getURL("${doc.space}.WebHome", 'view') $doc.space 'tmSpace' 'hasIcon')
+  #xwikitopmenuentrystart($xwiki.getURL("${doc.space}.WebHome", 'view') "$!{escapetool.xml($doc.space)}" 'tmSpace' 'hasIcon')
   #if ($hasCreatePage)
     #submenuitem("$doc.getURL('view', 'xpage=createdocument&amp;tocreate=page')" $msg.get('core.menu.create.page') 'tmCreatePage', '')
     ## Only display the Office Importer menu action if the Office Importer application is installed
     #set($officeImporterMainDocument = $xwiki.getDocument('XWiki.OfficeImporter'))
     #if("$!{officeImporterMainDocument.isNew()}" == 'false')
-      #submenuitem($officeImporterMainDocument.getURL('view', "&amp;parent=$doc.fullName") $msg.get('core.menu.create.pageFromOffice') 'tmCreatePageFromOffice', '')
+      #submenuitem($officeImporterMainDocument.getURL('view', "&amp;parent=$!{escapetool.url($doc.fullName)}") $msg.get('core.menu.create.pageFromOffice') 'tmCreatePageFromOffice', '')
     #end
   #end
   #if ($hasWatch)
     #set ($isSpaceWatched = $xwiki.watchlist.isSpaceWatched())
     #if (!$isSpaceWatched)
-      #submenuitem("$doc.getURL('view', 'xpage=watch&amp;do=addspace')&amp;xredirect=$doc.getURL()" $msg.get('core.menu.watchlist.add.space', [$xwiki.getXMLEncoded($doc.space)]) 'tmWatchSpace', '')
+      #submenuitem("$doc.getURL('view', 'xpage=watch&amp;do=addspace')&amp;xredirect=$doc.getURL()" $msg.get('core.menu.watchlist.add.space', [$escapetool.xml($doc.space)]) 'tmWatchSpace', '')
     #else
       #submenuitem("$doc.getURL('view', 'xpage=watch&amp;do=removespace')&amp;xredirect=$doc.getURL()" $msg.get('core.menu.watchlist.remove.space') 'tmUnwatchSpace', '')
     #end
   #end
   #if($hasSpaceAdmin)
     #set ($adminspaceaction = $!xwiki.getURL("${doc.space}.WebPreferences", 'admin'))
-    #submenuitem($adminspaceaction $msg.get('core.menu.admin.space', [$xwiki.getXMLEncoded($doc.space)]) 'tmAdminSpace')
+    #submenuitem($adminspaceaction $msg.get('core.menu.admin.space', [$escapetool.xml($doc.space)]) 'tmAdminSpace')
   #end
   #xwikitopmenuentryend()
 #end
Index: web/standard/src/main/webapp/templates/javascript.vm
===================================================================
--- web/standard/src/main/webapp/templates/javascript.vm	(revision 28993)
+++ web/standard/src/main/webapp/templates/javascript.vm	(working copy)
@@ -27,8 +27,8 @@
 XWiki.webapppath = "${xwiki.webAppPath}";
 XWiki.servletpath = "${xwiki.servletPath}";
 XWiki.contextPath = "${request.contextPath}";
-XWiki.mainWiki = "${context.mainWikiName}";
-XWiki.currentWiki = "${context.database}";
+XWiki.mainWiki = "$!{escapetool.javascript(${context.mainWikiName})}";
+XWiki.currentWiki = "$!{escapetool.javascript(${context.database})}";
 XWiki.currentSpace = "$!{escapetool.javascript($doc.space)}";
 XWiki.currentPage = "$!{escapetool.javascript($doc.name)}";
 XWiki.editor = "$!{escapetool.javascript($editor)}";
Index: web/standard/src/main/webapp/templates/menuview.vm
===================================================================
--- web/standard/src/main/webapp/templates/menuview.vm	(revision 28993)
+++ web/standard/src/main/webapp/templates/menuview.vm	(working copy)
@@ -11,13 +11,13 @@
   #set ($adminapppresent = $xwiki.exists('XWiki.AdminSheet'))
   #if(!$hasAdminWikiRights && $adminapppresent)
     #xwikitopmenuentrystart($adminspaceaction $msg.get('core.menu.admin') 'tmAdmin')
-    #submenuitem($adminspaceaction $msg.get('core.menu.admin.space', [$doc.space]) 'tmAdminspace')
+    #submenuitem($adminspaceaction $msg.get('core.menu.admin.space', ["$!{escapetool.xml($doc.space)}"]) 'tmAdminspace')
     #xwikitopmenuentryend()
   #else
     #if ($adminapppresent)
       #xwikitopmenuentrystart($adminwikiaction $msg.get('core.menu.admin') 'tmAdmin')
       #submenuitem($adminwikiaction $msg.get('core.menu.admin.wiki') 'tmAdminwiki')
-      #submenuitem($adminspaceaction $msg.get('core.menu.admin.space', [$xwiki.getXMLEncoded($doc.space)]) 'tmAdminspace')
+      #submenuitem($adminspaceaction $msg.get('core.menu.admin.space', ["$!{escapetool.xml($doc.space)}"]) 'tmAdminspace')
       #xwikitopmenuentryend()
     #else
       #xwikitopmenuentry($importaction $msg.get('core.menu.admin') 'tmAdmin')
@@ -37,8 +37,8 @@
 ##
 ##if($hasEdit)
 ### #xwikitopmenuentrystart($doc.getURL($editaction, $!languageparams) $msg.get('core.menu.create') 'tmCreate')
-##xwikitopmenuentrystart($xwiki.getURL('XWiki.CreateSubpage', 'view', "parent=${doc.fullName}") $msg.get('core.menu.create') 'tmCreate')
-##submenuitem($xwiki.getURL('XWiki.CreatePage', 'view', "parent=${doc.fullName}") $msg.get('core.menu.create.page') 'tmCreatePage')
+##xwikitopmenuentrystart($xwiki.getURL('XWiki.CreateSubpage', 'view', "parent=$!{escapetool.url(${doc.fullName})}") $msg.get('core.menu.create') 'tmCreate')
+##submenuitem($xwiki.getURL('XWiki.CreatePage', 'view', "parent=$!{escapetool.url(${doc.fullName})}") $msg.get('core.menu.create.page') 'tmCreatePage')
 ##submenuitem($xwiki.getURL('XWiki.CreatePage', 'view', 'tocreate=space') $msg.get('core.menu.create.space') 'tmCreateSpace')
 ##submenuitem($xwiki.getURL('Blog.CreateBlogPost') $msg.get('core.menu.create.blogpost') 'tmCreateBlogPost')
 ##if($xwiki.hasAccessLevel('edit', 'Main.EventCalendar'))#submenuitem($xwiki.getURL('Main.EventCalendar') $msg.get('core.menu.create.event') 'tmCreateCalendarEvent')#end
@@ -51,7 +51,7 @@
 #if($isAdvancedUser)
 #xwikitopmenuentrystart($doc.getURL($editaction, $!languageparams) $msg.get('core.menu.edit') 'tmEdit')
 #submenuitem($doc.getURL('edit', "$!{languageparams}&amp;editor=wiki") $msg.get('core.menu.edit.wiki') 'tmEditWiki')
-#submenuitem($doc.getURL('edit', "$!languageparams&amp;editor=wysiwyg") $msg.get('core.menu.edit.wysiwyg') 'tmEditWysiwyg')
+#submenuitem($doc.getURL('edit', "$!{languageparams}&amp;editor=wysiwyg") $msg.get('core.menu.edit.wysiwyg') 'tmEditWysiwyg')
 #submenuitem($doc.getURL('inline', $!languageparams) $msg.get('core.menu.edit.inline') 'tmEditInline')
 #submenuseparator()
 #submenuitem($doc.getURL('edit', 'editor=rights') $msg.get('core.menu.edit.rights') 'tmEditRights')
@@ -113,7 +113,7 @@
 #submenuitem($doc.getURL('export', "format=pdf&amp;$!docvariant") $msg.get('core.menu.export.pdf') 'tmExportPdf')
 #submenuitem($doc.getURL('export', "format=rtf&amp;$!docvariant") $msg.get('core.menu.export.rtf') 'tmExportRtf')
 #submenuitem($doc.getURL('export', "format=html&amp;$!docvariant") $msg.get('core.menu.export.html') 'tmExportHtml')
-#submenuitem($doc.getURL('export', "format=xar&amp;name=$util.encodeURI($doc.fullName)&amp;pages=$util.encodeURI($doc.fullName)&amp;$!docvariant") $msg.get('core.menu.export.xar') 'tmExportXar')
+#submenuitem($doc.getURL('export', "format=xar&amp;name=$escapetool.url($doc.fullName)&amp;pages=$escapetool.url($doc.fullName)&amp;$!docvariant") $msg.get('core.menu.export.xar') 'tmExportXar')
 #xwikitopmenuentryend()
 ##
 ## Actions menu
@@ -183,13 +183,13 @@
   #end
   #submenuseparator()
   #if (!$isSpaceWatched)
-    #submenuitem("javascript:watchlist('addspace')" $msg.get('core.menu.watchlist.add.space', [$xwiki.getXMLEncoded($doc.space)]) 'tmWatchSpace')
+    #submenuitem("javascript:watchlist('addspace')" $msg.get('core.menu.watchlist.add.space', [$escapetool.xml($doc.space)]) 'tmWatchSpace')
   #else
     #submenuitem("javascript:watchlist('removespace')" $msg.get('core.menu.watchlist.remove.space') 'tmUnwatchSpace')
   #end
   #submenuseparator()
   #if (!$isWikiWatched)
-    #submenuitem("javascript:watchlist('addwiki')" $msg.get('core.menu.watchlist.add.wiki', [$xwiki.getXMLEncoded($doc.wiki)]) 'tmWatchWiki')
+    #submenuitem("javascript:watchlist('addwiki')" $msg.get('core.menu.watchlist.add.wiki', [$escapetool.xml($doc.wiki)]) 'tmWatchWiki')
   #else
     #submenuitem("javascript:watchlist('removewiki')" $msg.get('core.menu.watchlist.remove.wiki') 'tmUnwatchWiki')
   #end
Index: web/standard/src/main/webapp/templates/space.vm
===================================================================
--- web/standard/src/main/webapp/templates/space.vm	(revision 28993)
+++ web/standard/src/main/webapp/templates/space.vm	(working copy)
@@ -6,7 +6,7 @@
 #set($discard = $parents.add($parent))
 #set($pdoc = $xwiki.getDocument($parent).getTranslatedDocument())
 #set($pdocurl = $pdoc.getURL("view"))
-#set($nstring = "<a href='$pdocurl'>$xwiki.getXMLEncoded(${pdoc.getRenderedTitle('plain/1.0')})</a> &gt; $string")
+#set($nstring = "<a href='$pdocurl'>$escapetool.xml(${pdoc.getRenderedTitle('plain/1.0')})</a> &gt; $string")
 #set($level = $level + 1)
 #breadcrumb($pdoc $nstring $level)
 #else
@@ -18,8 +18,8 @@
 <div class="minwidth"></div>
 <hr/>
   <div id="breadcrumbs">
-    <span class="breadcrumbspace"><a href="$spaceViewUrl">$xwiki.getXMLEncoded(${doc.space})</a>: </span>
-#breadcrumb($doc "<a href='${doc.getURL('view')}'>$xwiki.getXMLEncoded($tdoc.getRenderedTitle('plain/1.0'))</a>" 0)
+    <span class="breadcrumbspace"><a href="$spaceViewUrl">$escapetool.xml(${doc.space})</a>: </span>
+#breadcrumb($doc "<a href='${doc.getURL('view')}'>$escapetool.xml($tdoc.getRenderedTitle('plain/1.0'))</a>" 0)
   </div>
 <hr/>
 </div>
Index: web/standard/src/main/webapp/templates/xwikivars.vm
===================================================================
--- web/standard/src/main/webapp/templates/xwikivars.vm	(revision 28993)
+++ web/standard/src/main/webapp/templates/xwikivars.vm	(working copy)
@@ -48,16 +48,16 @@
 ## preference and all public API will do the hidden spaces filtering by default. 
 ## ======================================================================================
 #set($dump = $request.getSession().setAttribute("blacklistedSpaces", $blacklistedSpaces))
-#set($parent ="<a href='$parentDoc.getURL()'>$xwiki.getXMLEncoded(${parentDoc.displayTitle})</a>")
+#set($parent ="<a href='$parentDoc.getURL()'>$escapetool.xml(${parentDoc.displayTitle})</a>")
 #if($tdoc)
-#set($headertitle = "<a href='$viewUrl'>$xwiki.getXMLEncoded(${tdoc.displayTitle})</a>")
+#set($headertitle = "<a href='$viewUrl'>$escapetool.xml(${tdoc.displayTitle})</a>")
 #else
-#set($headertitle = "<a href='$viewUrl'>$xwiki.getXMLEncoded(${doc.displayTitle})</a>")
+#set($headertitle = "<a href='$viewUrl'>$escapetool.xml(${doc.displayTitle})</a>")
 #end
 #set($skin=$xwiki.getSkin())
-#set($copyright=$xwiki.getSpaceCopyright())
+#set($copyright = "$!{escapetool.xml($xwiki.getSpaceCopyright())}")
 #set($xwikimode=$context.getMode())
-#set($logredir = $xwiki.getFormEncoded($xwiki.getRequestURL()))
+#set($logredir = $escapetool.xml($xwiki.getRequestURL()))
 ##
 #if($xwiki.exists("XWiki.MaintenanceInfo"))
 #set($maintenanceinfo = "XWiki.MaintenanceInfo")
@@ -73,7 +73,7 @@
 #end
 ## Check revision option
 #if ($request.rev)
-#set($revparams="rev=${request.rev}")
+#set($revparams = "rev=$!{escapetool.xml(${request.rev})}")
 #else
 #set($revparams = "")
 #end
